/*
 * @Author: ganxiaochuan
 * @Date: 2021-01-18 09:55:21
 * @LastEditors: ganxiaochuan
 * @LastEditTime: 2021-01-18 15:05:00
 * @Description: file content
 */
const config = require('./src/utils/megreConfig.js')
const proxyConfig = require('./src/config.js').API_URL
let proxy = {}
for (let key in proxyConfig) {
  let pathRewriteKeyword = '^/' + key
  proxy[key] = {
    target: proxyConfig[key],
    ws: true,
    changeOrigin: true,
    cookieDomainRewrite: 'localhost',
    cookiePathRewrite: 'qmjs',
  }
  proxy[key].pathRewrite = {
    [pathRewriteKeyword]: '/'
  }
}
console.log(proxy)
module.exports = config({
  devServer: {
    proxy
  },
  chainWebpack: config => {
    config
      .plugin('html')
      .tap(args => {
        args[0].title= '单点管理系统'
        return args
      })
  },
})